package org.idea.iedis.framework.server.io.core.nio.selector;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

/**
 * @Author linhao
 * @Date created in 8:53 上午 2021/8/17
 */
public class NioSelectorClient {

    public static void main(String[] args) throws IOException, InterruptedException {
        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.connect(new InetSocketAddress("localhost",6555));
        socketChannel.configureBlocking(false);
        while (true) {
            System.out.println("client send data");
            socketChannel.write(ByteBuffer.wrap(("this is success " + Thread.currentThread().getName()).getBytes()));
            Thread.sleep(2500);
        }
    }
}
